package com.example.delegator;

import com.alibaba.fastjson.JSONObject;
import com.example.dto.EnumViewDTO;
import com.example.vo.AttributeUpdateFormVO;
import com.huawei.innovation.rdm.coresdk.basic.util.XDMDelegatorJsonUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

@Repository
public class CustomEXADefinitionDelegator {

    private String uri = "rdm/basic/api";
    private String moduleName = "EXADefinition";
    @Autowired
    private CustomDelegatorService customDelegatorService;
    private String pattern = "yyyy-MM-dd'T'HH:mm:ss.SSSZ";
    public List<EnumViewDTO> queryAllEnumInfo(){
        List list = (List)customDelegatorService.Get(uri,moduleName,"queryAllEnumInfo", Collections.emptyMap());
        return XDMDelegatorJsonUtil.jsonToDTOList(list, EnumViewDTO.class, this.pattern);
    }
//    public Object updateAttribute(AttributeUpdateFormVO vo){
//        Map<String, Object> map = new HashMap<>();
//        map.put("id", vo.getId());
//        map.put("name", vo.getName());
//        map.put("nameEn", vo.getNameEn());
//        map.put("description", vo.getDescription());
//        map.put("descriptionEn", vo.getDescriptionEn());
//        map.put("disableFlag", vo.getDisableFlag());
//        JSONObject jsonObject = new JSONObject();
//        jsonObject.put("params",new JSONObject(map));
//        Object update = customDelegatorService.Post(uri, moduleName, "update", jsonObject);
//        return update;
//    }
}
